﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.Specialized;

namespace OAuth
{
    internal class OAuthMessage
    {
        public OAuthMessage() { }

        public OAuthMessage(
            Uri uri,
            OAuthHttpMethod httpMethod,
            IDictionary<string, string> headers,
            byte[] postBytes)
        {
            this.Uri = uri;
            this.HttpMethod = httpMethod;
            this.HttpHeaders = headers;
            this.PostBytes = postBytes;
        }

        public Uri Uri { get; set; }
        public OAuthHttpMethod HttpMethod { get; set; }
        public byte[] PostBytes { get; set; }
        public IDictionary<string, string> HttpHeaders { get; set; }

        public static OAuthMessage ForPost(
            Uri uri,
            IDictionary<string, string> headers,
            byte[] postBytes)
        {
            return new OAuthMessage(uri, OAuthHttpMethod.POST, headers, postBytes);
        }

        public static OAuthMessage ForPut(
            Uri uri,
            IDictionary<string, string> headers,
            byte[] postBytes)
        {
            return new OAuthMessage(uri, OAuthHttpMethod.PUT, headers, postBytes);
        }

        public static OAuthMessage ForGet(
            Uri uri,
            IDictionary<string, string> headers)
        {
            return new OAuthMessage(uri, OAuthHttpMethod.GET, headers, null);
        }

        public static OAuthMessage ForDelete(
            Uri uri,
            IDictionary<string, string> headers)
        {
            return new OAuthMessage(uri, OAuthHttpMethod.DELETE, headers, null);
        }
    }
}